package ltd.smallwang.domain.task.constant;

import com.alibaba.cola.exception.BizException;
import lombok.Getter;

/**
 * @author justd
 * @description 功能描述
 * @since 2024-05-01 01:23
 **/
@Getter
public enum RecordByEnum {
  /**
   * 人工
   */
  MANUAL(0),
  /**
   * 番茄时钟
   */
  TOMATO_CLOCK(1),
  /**
   * 日历
   */
  CALENDAR(2);

  private final Integer recordBy;

  RecordByEnum(Integer recordBy) {
    this.recordBy = recordBy;
  }

  public static RecordByEnum init(Integer recordBy) {
    for (RecordByEnum recordByEnum : RecordByEnum.values()) {
      if (recordByEnum.getRecordBy().equals(recordBy)) {
        return recordByEnum;
      }
    }
    throw new BizException("enum init error");
  }
}
